<%@ page language="java" contentType="text/html; charset=utf-8" isELIgnored="false"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
<link href="${pageContext.request.contextPath}/fare/lib/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link rev="stylesheet" media="all" href="${pageContext.request.contextPath}/fare/css/form_style.css" type="text/css" rel="stylesheet">	
<title>机场管理</title>
<jsp:include page="/fare/cityManage/right_head.jsp"></jsp:include>
<script type="text/javascript">
function addToolBar() {
	$("#toptoolbar").ligerToolBar({
		items :[ {
			text : '增加城市子节点',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/add.png",
			click : function(item) {
				location.href = '${pageContext.request.contextPath}/cityManage/toEditCity.action?vo.portEntity.pid=${vo.mid}'; 
			}
		},
		{
			line : true
		}, {
			text : '增加机场子节点',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_edit.gif",
			click :  function(item) {
				location.href = '${pageContext.request.contextPath}/cityManage/toEditPort.action?vo.portEntity.pid=${vo.mid}'; 
				
			}
		}, 
		<c:if test="${vo.mid ne 'CITY_TREE' }">
		{
			line : true
		}, {
			text : '删除',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_delete.gif",
			click :  function(item) {
				if(confirm("你的操作将无法恢复，确定删除该节点及该节点下的子节点？")){
				$.ajax({
					type: "post",
					url: "${pageContext.request.contextPath}/cityManage/delete.action?vo.mid=${vo.mid}",
					dataType: "json",
					success: function(resultData){
						alert(resultData);
					},
					error : function(message) {
						alert("系统出现异常。");
					}
				});
			}
			}
		}, 
		</c:if>
		{
			line : true
		}, {
			text : '创建super用户城市选择框数据',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_edit.gif",
			click :  function(item) {
				createScript();
			}
		}, 
		{
			line : true
		}, {
			text : '创建8个航空公司选择框数据 ',
			img : "${pageContext.request.contextPath}/images/icons/toolbar/page_edit.gif",
			click :  function(item) {
				createSingleScript();
			}
		}, 
		{
			line : true
		} ]
	});
}



$(function (){
 	addToolBar();
	parent.closeWaiting();
	
	var message = '${vo.message}';
	if(message!=''){
		alert(message);
	}
});


function submitForm(){
	if($("#form1").valid()){
		document.forms[0].submit();
	}
}


$(function(){
	$('#depCity').querycity({'data':citysFlight,'tabs':labelFromcity});
	$('#arrCity').querycity({'data':citysFlight,'tabs':labelFromcity});
})
function createScript(){
	$.ajax({
		   type: "POST",
		   url: "createCityScriptAction!getAllCityInfo.action",
		   dataType:"text",
		   success: function(msg){
		     alert(msg);
		   }
		});
}
function createSingleScript(){
	var item = $("input[name='sourceId']:checked").val();
/* 	if(typeof(item) == "undefined"){
		alert("请选择航空公司!");
	}else{ */
		$.ajax({
			   type: "POST",
			   url: "createCityScriptAction!getCityInfoByCompany.action",
			   data: "sourceId="+item,
			   dataType:"text",
			   success: function(msg){
				   alert(msg);
			   }
		});
	/* } */
	
}
</script>


</head>
<body>
<jsp:include page="/pages/system/feedback/feedback.jsp"></jsp:include>
<form id="form1"  vanadiumType='multi' action="${pageContext.request.contextPath}/cityManage/savePort.action" method="post">


<div class="main main_max minhgt450">
	<div class="sideBar">
	<div class="box">
		<div class="location">当前位置： 航空业基础数据 &gt; 城市信息设置</div>
	</div>
	</div>
	
	<HR style="FILTER: progid:DXImageTransform.Microsoft.Shadow(color:#987cb9,direction:145,strength:15)" width="80%" color=#987cb9 SIZE=1>
	<div class="l-topmenu-index">
		<div id="toptoolbar"></div>
	</div>
	<div class="form_table_tltle">城市信息设置 </div>
             <ul id="errorlist"></ul>
                 <table cellSpacing=0 cellPadding=0 width="100%" border=0 class="form_table">
                       <tbody>
                      	<c:if test="${not empty vo.portEntity.portCode}">
	                      	<tr>
		                         <td align="right" class="left"  valign="middle">机场编码&nbsp;</td>
		                         <td>
		                           <input disabled class="input_205 input_txt cname" id="id" name="vo.portEntity.portCode" value="${vo.portEntity.portCode}" size="20"  type="text">
		                         </td>
		                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
	                     	</tr>
	                     	
	                     	<tr>
		                         <td align="right" class="left"  valign="middle">父级城市id&nbsp;</td>
		                         <td>
		                           <input validate=":required;:number;" class="input_205 input_txt cname" id="id" name="vo.portEntity.cityId" value="${vo.portEntity.cityId}" size="20"  type="text">
		                         </td>
		                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
	                     	</tr>
	                     	
                      	</c:if> 
                      	<c:if test="${empty vo.portEntity.portCode}">	
	                   	 <tr>
	                         <td align="right" class="left"  valign="middle">父级城市id&nbsp;</td>
	                         <td>
	                           <input disabled class="input_205 input_txt cname" id="cityCode" name="vo.portEntity.cityId" value="${vo.portEntity.cityId}" size="20"  type="text">
	                           <input class="input_205 input_txt cname" id="cityCode" name="vo.portEntity.cityId" value="${vo.portEntity.cityId}" size="20"  type="hidden">
	                         </td>
	                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
	                     </tr>
	                     <tr>
                         <td align="right" class="left"  valign="middle">机场编码&nbsp;</td>
                         <td>
                           <input validate=":required; :min_length;2" class="input_205 input_txt cname" id="cityCode" name="vo.portEntity.portCode" value="${vo.portEntity.portCode}" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr> 
                     </c:if> 
                   
                      <tr>
                         <td align="right" class="left"  valign="middle">机场名称&nbsp;</td>
                         <td>
                           <input onchange="$('#sortCityText').text(this.value);" validate=":required; :min_length;2 :max_length;100" class="input_205 input_txt cname" id="cityName" maxlength="20" minlength="3"  name="vo.portEntity.portName" value="${vo.portEntity.portName}" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                      <tr>
                         <td align="right" class="left"  valign="middle">机场拼音&nbsp;</td>
                         <td>
                           <input validate=":min_length;2 :max_length;100" class="input_205 input_txt cname" id="nameSpell"  name="vo.portEntity.nameSpell" value="${vo.portEntity.nameSpell }" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                      <tr>
                         <td align="right" class="left"  valign="middle">拼音简称&nbsp;</td>
                         <td>
                           <input validate=":min_length;2 :max_length;100" class="input_205 input_txt cname" id="nameSpellInitials" name="vo.portEntity.nameSpellInitials" value="${vo.portEntity.nameSpellInitials }" size="20"  type="text">
                         </td>
                         <td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
                     </tr>
                    
                <tr>
					<td align="right" class="left" valign="middle">排序号：</td>
					<td ></td>
					<td><div id="user_nameTip" class="userTip_div" style="width:250px"></div></td>
				</tr>
				<tr>
					<td align="right" id="sortCityText" class="l-table-edit-td">${vo.portEntity.portName }</td>
					<td align="left" class="l-table-edit-td"> 
					<input name="vo.portEntity.treeSort"
						 type="text" id="txtName" ltype="text"
						value="${vo.portEntity.treeSort }"
						validate=":required;:min_length;1;:maxlength:10;:number;" /></td>
					<td align="left"></td>
				</tr>
			<c:if test="${not empty vo.parentNode }">
			<c:forEach var="node" items="${vo.parentNode.children }" varStatus="status">
			<c:if test="${node.id ne vo.mid }">
				<tr>
					<td align="right" class="l-table-edit-td">${node.text }</td>
					<td align="left" class="l-table-edit-td"><input
						name="vo.parentNode.children[${status.index }].portCode" type="hidden"
						value="${node.id }" /> <input
						name="vo.parentNode.children[${status.index }].orderId"
						 type="text" id="txtName" ltype="text"
						value="${node.orderId }"
						validate=":required:min_length;1:maxlength:10:number;" /></td>
					<td align="left"></td>
				</tr>
				</c:if>
			</c:forEach>
			</c:if>
				
                 </tbody></table>
			</div>
			<div  align="center"><input class="l-button l-button-submit"   type="submit" name="submit" value="保存" /></div>
</form>

</body>
</html>